Skip to content

Fix occasional segfault in WContainerWidget::widget called by WTableView::setHeaderHeight#238

Open
m-seibt wants to merge 2 commits intoemweb:masterfrom
m-seibt:fix/sf_WContainerWidget_widget_throw
Open

Fix occasional segfault in WContainerWidget::widget called by WTableView::setHeaderHeight#238
m-seibt wants to merge 2 commits intoemweb:masterfrom
m-seibt:fix/sf_WContainerWidget_widget_throw

Conversation

@m-seibt
Copy link

@m-seibt m-seibt commented Feb 24, 2026

  • WContainerWidget::widget: Throw WException on invalid index instead of segfaulting
  • WTableView::headerWidget: Avoid accessing a not (yet?) existing cell widget, then return nullptr
    At least WAbstractItemView::setHeaderHeight properly checks for nullptr.

The segfault occasionally occurred when calling WTableView::setHeaderHeight during WebController::doCreateApplication with Wt 4.12.3.
Partial call stack:

libwt.so.4.12.3!Wt::WContainerWidget::widget(const Wt::WContainerWidget * const this, int index) (\root\parts\wt\src\src\Wt\WContainerWidget.C:244)
libwt.so.4.12.3!Wt::WTableView::headerWidget(Wt::WTableView * const this, int column, bool contentsOnly) (\root\parts\wt\src\src\Wt\WTableView.C:1319)
libwt.so.4.12.3!Wt::WAbstractItemView::setHeaderHeight(Wt::WAbstractItemView * const this, Wt::WAbstractItemView * const this@entry, const Wt::WLength & height) (\root\parts\wt\src\src\Wt\WAbstractItemView.C:1317)
libwt.so.4.12.3!Wt::WTableView::setHeaderHeight(Wt::WTableView * const this, const Wt::WLength & height) (\root\parts\wt\src\src\Wt\WTableView.C:1299)

...

libwt.so.4.12.3!std::function<std::unique_ptr<Wt::WApplication, std::default_delete<Wt::WApplication> > (Wt::WEnvironment const&)>::operator()(Wt::WEnvironment const&) const(const Wt::WEnvironment & __args#0, const std::function<std::unique_ptr<Wt::WApplication, std::default_delete<Wt::WApplication> >(const Wt::WEnvironment&)> * const this) (\usr\include\c++\13\bits\std_function.h:591)
libwt.so.4.12.3!Wt::WebController::doCreateApplication(Wt::WebController * const this, Wt::WebSession * session, Wt::WebSession * session@entry) (\root\parts\wt\src\src\web\WebController.C:902)
libwt.so.4.12.3!Wt::WebSession::start(Wt::WebSession * const this, Wt::WebSession * const this@entry, Wt::WebResponse * response) (\root\parts\wt\src\src\web\WebSession.C:706)
libwt.so.4.12.3!Wt::WebSession::handleRequest(Wt::WebSession * const this, Wt::WebSession::Handler & handler) (\root\parts\wt\src\src\web\WebSession.h:211)
libwt.so.4.12.3!Wt::WebController::handleRequest(Wt::WebController * const this, Wt::WebRequest * request) (\root\parts\wt\src\src\web\WebController.C:858)
libwthttp.so.4.12.3!std::__invoke_impl<void, void (Wt::WebController::*&)(Wt::WebRequest*), Wt::WebController*&, http::server::HTTPRequest*&>(void (Wt::WebController::*&)(Wt::WebController * const, Wt::WebRequest *) __f, Wt::WebController *& __t) (\usr\include\c++\13\bits\invoke.h:71)
libwthttp.so.4.12.3!std::__invoke<void (Wt::WebController::*&)(Wt::WebRequest*), Wt::WebController*&, http::server::HTTPRequest*&>(void (Wt::WebController::*&)(Wt::WebController * const, Wt::WebRequest *) __fn) (\usr\include\c++\13\bits\invoke.h:96)
libwthttp.so.4.12.3!std::_Bind<void (Wt::WebController::*(Wt::WebController*, http::server::HTTPRequest*))(Wt::WebRequest*)>::__call<void, , 0ul, 1ul>(std::tuple<>&&, std::_Index_tuple<0ul, 1ul>)(std::_Bind<void (Wt::WebController::*(Wt::WebController*, http::server::HTTPRequest*))(Wt::WebRequest*)> * const this) (\usr\include\c++\13\functional:506)
libwthttp.so.4.12.3!std::_Bind<void (Wt::WebController::*(Wt::WebController*, http::server::HTTPRequest*))(Wt::WebRequest*)>::operator()<, void>()(std::_Bind<void (Wt::WebController::*(Wt::WebController*, http::server::HTTPRequest*))(Wt::WebRequest*)> * const this) (\usr\include\c++\13\functional:591)
libwthttp.so.4.12.3!boost::asio::detail::binder0<std::_Bind<void (Wt::WebController::*(Wt::WebController*, http::server::HTTPRequest*))(Wt::WebRequest*)> >::operator()()(boost::asio::detail::binder0<std::_Bind<void (Wt::WebController::*(Wt::WebController*, http::server::HTTPRequest*))(Wt::WebRequest*)> > * const this) (\root\parts\libboost\install\usr\include\boost\asio\detail\bind_handler.hpp:56)
libwthttp.so.4.12.3!boost::asio::detail::executor_op<boost::asio::detail::binder0<std::_Bind<void (Wt::WebController::*(Wt::WebController*, http::server::HTTPRequest*))(Wt::WebRequest*)> >, std::allocator<void>, boost::asio::detail::scheduler_operation>::do_complete(void*, boost::asio::detail::scheduler_operation*, boost::system::error_code const&, unsigned long)(void * owner, boost::asio::detail::scheduler_operation * base) (\root\parts\libboost\install\usr\include\boost\asio\detail\executor_op.hpp:70)
libwt.so.4.12.3!boost::asio::detail::scheduler_operation::complete(std::size_t bytes_transferred, const boost::system::error_code & ec, void * owner, boost::asio::detail::scheduler_operation * const this) (\root\parts\libboost\install\usr\include\boost\asio\detail\scheduler_operation.hpp:40)
libwt.so.4.12.3!boost::asio::detail::scheduler::do_run_one(boost::asio::detail::scheduler * const this, boost::asio::detail::scheduler * const this@entry, boost::asio::detail::conditionally_enabled_mutex::scoped_lock & lock, boost::asio::detail::scheduler::thread_info & this_thread, const boost::system::error_code & ec) (\root\parts\libboost\install\usr\include\boost\asio\detail\impl\scheduler.ipp:501)
libwt.so.4.12.3!boost::asio::detail::scheduler::run(boost::asio::detail::scheduler * const this, boost::system::error_code & ec) (\root\parts\libboost\install\usr\include\boost\asio\detail\impl\scheduler.ipp:217)
libwt.so.4.12.3!boost::asio::io_context::run(boost::asio::io_context * const this) (\root\parts\libboost\install\usr\include\boost\asio\impl\io_context.ipp:63)
libwt.so.4.12.3!Wt::WIOService::run(Wt::WIOService * const this) (\root\parts\wt\src\src\Wt\WIOService.C:185)
libstdc++.so.6!std::execute_native_thread_routine(void * __p) (\build\gcc-14-ig5ci0\gcc-14-14.2.0\src\libstdc++-v3\src\c++11\thread.cc:104)
libc.so.6!start_thread(void * arg) (pthread_create.c:447)
libc.so.6!clone3() (clone3.S:78)

The SF occurred when calling WTableView::setHeaderHeight
during WebController::doCreateApplication.
@m-seibt
Copy link
Author

m-seibt commented Feb 25, 2026

Hi @MatthiasVC,

from other PRs here, I know that you use to merge them in a bunch.
Do you need a Redmine ticket or anything else?
The issue should be resolved in 4.12.4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant